home *** CD-ROM | disk | FTP | other *** search
/ Risc World 5 / Risc World 5.iso / SOFTWARE / Issue3 / Games / xrick / !xrick / src / c / rects < prev    next >
Text File  |  2004-06-24  |  976b  |  52 lines

  1. /*
  2.  * xrick/src/rects.c
  3.  *
  4.  * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved.
  5.  *
  6.  * The use and distribution terms for this software are contained in the file
  7.  * named README, which can be found in the root of this distribution. By
  8.  * using this software in any fashion, you are agreeing to be bound by the
  9.  * terms of this license.
  10.  *
  11.  * You must not remove this notice, or any other, from this software.
  12.  */
  13.  
  14. #include <stdlib.h>  /* malloc */
  15.  
  16. #include "system.h"
  17. #include "rects.h"
  18.  
  19.  
  20. /*
  21.  * Free a list of rectangles and set the pointer to NULL.
  22.  *
  23.  * p: rectangle list CHANGED to NULL
  24.  */
  25. void
  26. rects_free(rect_t *r) {
  27.   if (r) {
  28.     rects_free(r->next);
  29.     free(r);
  30.   }
  31. }
  32.  
  33.  
  34. /*
  35.  * Add a rectangle to a list of rectangles
  36.  */
  37. rect_t *
  38. rects_new(U16 x, U16 y, U16 width, U16 height, rect_t *next)
  39. {
  40.   rect_t *r;
  41.  
  42.   r = malloc(sizeof *r);
  43.   r->x = x;
  44.   r->y = y;
  45.   r->width = width;
  46.   r->height = height;
  47.   r->next = next;
  48.   return r;
  49. }
  50.  
  51. /* eof */
  52.